#include "pump.h"
#include "bsp_pwm.h"

PWM_Init_Config_s PWMConfig = {
    .htim = &htim1,
    .channel = TIM_CHANNEL_2,
    .period = 0.005f,
    .dutyratio = 0.0f,
};

class Pump {
public:
    static Pump& getInstance(){static Pump instance; return instance;};
    PWMInstance* pumpPWM;
private:
    static Pump instance;
    Pump(){pumpPWM = PWMRegister(&PWMConfig);};
};

void pumpSetSuction(const float ratio) {
    PWMSetDutyRatio(Pump::getInstance().pumpPWM,ratio);
}
